// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.

#pragma once
#ifndef MSO_COMPILERADAPTERS_COMPILERWARNINGS_H
#define MSO_COMPILERADAPTERS_COMPILERWARNINGS_H

/**
  This header contains cross-plat macros for suppressing compiler warnings

  Alphabetically add a [BEGIN|END]_DISABLE_WARNING_* pair of macros for the compiler warning.

  clang-only: use BEGIN_DISABLE_COMPILER_WARNING_CLANG with the -W argument
  msvc-only: use BEGIN_DISABLE_COMPILER_WARNING_MSVC with the warning number
  gcc-only: use BEGIN_DISABLE_COMPILER_WARNING_GCC with the -W argument
  all: use BEGIN_DISABLE_COMPILER_WARNING_ALL with all values

  FUTURE: auto-generate this from shared file
*/

#include "compilerWarnings_impl.h"

#define BEGIN_DISABLE_WARNING_ASSIGNMENT_OPERATOR_IMPLICITLY_DELETED() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4626)
#define END_DISABLE_WARNING_ASSIGNMENT_OPERATOR_IMPLICITLY_DELETED() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_CONDITIONAL_EXPRESSION_IS_CONSTANT() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4127)
#define END_DISABLE_WARNING_CONDITIONAL_EXPRESSION_IS_CONSTANT() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_COPY_CTOR_IMPLICITLY_DELETED() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4625)
#define END_DISABLE_WARNING_COPY_CTOR_IMPLICITLY_DELETED() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_DEPRECATED() \
  BEGIN_DISABLE_COMPILER_WARNING_ALL(4996, "-Wdeprecated-declarations", "-Wdeprecated-declarations")
#define END_DISABLE_WARNING_DEPRECATED() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_DEPRECATED_BY_PRAGMA() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4995)
#define END_DISABLE_WARNING_DEPRECATED_BY_PRAGMA() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_DESTRUCTOR_IMPLICITLY_DELETED() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4624)
#define END_DISABLE_WARNING_DESTRUCTOR_IMPLICITLY_DELETED() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_DESTRUCTOR_NOT_IMPLICITLY_CALLED() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4583)
#define END_DISABLE_WARNING_DESTRUCTOR_NOT_IMPLICITLY_CALLED() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_EXCEPTIONS_PARAMETER() \
  BEGIN_DISABLE_COMPILER_WARNING_ALL(4297, "-Wexceptions", "-Wterminate")
#define END_DISABLE_WARNING_EXCEPTIONS_PARAMETER() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_FALSE_CONSTANT_EXPR_IN_AND() BEGIN_DISABLE_COMPILER_WARNING_MSVC(25038)
#define END_DISABLE_WARNING_FALSE_CONSTANT_EXPR_IN_AND() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_FREESTANDING_CONSTANT() BEGIN_DISABLE_COMPILER_WARNING_MSVC(25049)
#define END_DISABLE_WARNING_FREESTANDING_CONSTANT() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_FUNCTION_CALLED_TWICE_IN_MACRO() BEGIN_DISABLE_COMPILER_WARNING_MSVC(25064)
#define END_DISABLE_WARNING_FUNCTION_CALLED_TWICE_IN_MACRO() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_FUNCTION_MAY_NOT_CALL_DTOR() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4611)
#define END_DISABLE_WARNING_FUNCTION_MAY_NOT_CALL_DTOR() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_HEADER_HYGIENE_VARIABLE() BEGIN_DISABLE_COMPILER_WARNING_CLANG("-Wheader-hygiene")
#define END_DISABLE_WARNING_HEADER_HYGIENE_VARIABLE() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_IF_CONDITION_IS_ALWAYS_FALSE() BEGIN_DISABLE_COMPILER_WARNING_MSVC(25042)
#define END_DISABLE_WARNING_IF_CONDITION_IS_ALWAYS_FALSE() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_IF_CONDITION_IS_ALWAYS_TRUE() BEGIN_DISABLE_COMPILER_WARNING_MSVC(25041)
#define END_DISABLE_WARNING_IF_CONDITION_IS_ALWAYS_TRUE() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_INCONSISTENT_MISSING_OVERRIDE() \
  BEGIN_DISABLE_COMPILER_WARNING_CLANG("-Winconsistent-missing-override")
#define END_DISABLE_WARNING_INCONSISTENT_MISSING_OVERRIDE() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_KEYWORD_IGNORED_NO_VARIABLE_DECL() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4091)
#define END_DISABLE_WARNING_KEYWORD_IGNORED_NO_VARIABLE_DECL() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_LOCAL_CLASS_FUNC_NOT_DEFINED() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4822)
#define END_DISABLE_WARNING_LOCAL_CLASS_FUNC_NOT_DEFINED() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_LOCAL_DECL_HIDES_PREVIOUS_LOCAL_DECL() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4456)
#define END_DISABLE_WARNING_LOCAL_DECL_HIDES_PREVIOUS_LOCAL_DECL() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_MACRO_REDEFINITION() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4005)
#define END_DISABLE_WARNING_MACRO_REDEFINITION() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_MISSING_ANNOTATION() BEGIN_DISABLE_COMPILER_WARNING_MSVC(25352)
#define END_DISABLE_WARNING_MISSING_ANNOTATION() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_MISSING_BREAK_OR_FALLTHROUGH() BEGIN_DISABLE_COMPILER_WARNING_MSVC(25011)
#define END_DISABLE_WARNING_MISSING_BREAK_OR_FALLTHROUGH() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_MIXING_SIGNED_AND_UNSIGNED_VARIABLES() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4389)
#define END_DISABLE_WARNING_MIXING_SIGNED_AND_UNSIGNED_VARIABLES() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_NATIVE_ENUM() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4472)
#define END_DISABLE_WARNING_NATIVE_ENUM() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_NONCONST_AGGREGATE_INITIALIZER() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4204)
#define END_DISABLE_WARNING_NONCONST_AGGREGATE_INITIALIZER() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_NONZERO_LOGICAL_AND() BEGIN_DISABLE_COMPILER_WARNING_MSVC(6239)
#define END_DISABLE_WARNING_NONZERO_LOGICAL_AND() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_NOTHROW_FUNC_THROWS() BEGIN_DISABLE_COMPILER_WARNING_MSVC(25306)
#define END_DISABLE_WARNING_NOTHROW_FUNC_THROWS() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_OFFSETOF_NONSTD_LAYOUT() BEGIN_DISABLE_COMPILER_WARNING_GCC("-Winvalid-offsetof")
#define END_DISABLE_WARNING_OFFSETOF_NONSTD_LAYOUT() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_PADDING_ADDED() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4820)
#define END_DISABLE_WARNING_PADDING_ADDED() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_SELF_ASSIGN_OVERLOADED() BEGIN_DISABLE_COMPILER_WARNING_CLANG("-Wself-assign-overloaded")
#define END_DISABLE_WARNING_SELF_ASSIGN_OVERLOADED() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_SELF_MOVE() BEGIN_DISABLE_COMPILER_WARNING_CLANG("-Wself-move")
#define END_DISABLE_WARNING_SELF_MOVE() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_SIGNED_TO_UNSIGNED_CONVERSION() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4018)
#define END_DISABLE_WARNING_SIGNED_TO_UNSIGNED_CONVERSION() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_TRUE_CONSTANT_EXPR_IN_AND() BEGIN_DISABLE_COMPILER_WARNING_MSVC(25037)
#define END_DISABLE_WARNING_TRUE_CONSTANT_EXPR_IN_AND() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_TRUE_CONSTANT_EXPR_IN_OR() BEGIN_DISABLE_COMPILER_WARNING_MSVC(25039)
#define END_DISABLE_WARNING_TRUE_CONSTANT_EXPR_IN_OR() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_UNREACHABLE_CODE() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4702)
#define END_DISABLE_WARNING_UNREACHABLE_CODE() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_UNUSED_CONST_VARIABLE()             \
  BEGIN_DISABLE_COMPILER_WARNING_CLANG("-Wunused-const-variable") \
  BEGIN_DISABLE_COMPILER_WARNING_GCC("-Wunused-const-variable")
#define END_DISABLE_WARNING_UNUSED_CONST_VARIABLE() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_UNUSED_FUNCTION()             \
  BEGIN_DISABLE_COMPILER_WARNING_CLANG("-Wunused-function") \
  BEGIN_DISABLE_COMPILER_WARNING_GCC("-Wunused-function")
#define END_DISABLE_WARNING_UNUSED_FUNCTION() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_UNUSED_PARAMETER() \
  BEGIN_DISABLE_COMPILER_WARNING_ALL(4100, "-Wunused-parameter", "-Wunused-parameter")
#define END_DISABLE_WARNING_UNUSED_PARAMETER() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_UNUSED_VALUE()             \
  BEGIN_DISABLE_COMPILER_WARNING_CLANG("-Wunused-value") \
  BEGIN_DISABLE_COMPILER_WARNING_GCC("-Wunused-value")
#define END_DISABLE_WARNING_UNUSED_VALUE() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_UNUSED_VARIABLE() \
  BEGIN_DISABLE_COMPILER_WARNING_ALL(4189, "-Wunused-variable", "-Wunused-variable")
#define END_DISABLE_WARNING_UNUSED_VARIABLE() END_DISABLE_COMPILER_WARNING()

#define BEGIN_DISABLE_WARNING_USING_UNINITIALIZED_VARIABLE() BEGIN_DISABLE_COMPILER_WARNING_MSVC(4700)
#define END_DISABLE_WARNING_USING_UNINITIALIZED_VARIABLE() END_DISABLE_COMPILER_WARNING()

#endif // MSO_COMPILERADAPTERS_COMPILERWARNINGS_H
